package com.dataType;

public class Variable {

    //静态变量，不用实例化类就能用。类初始化就能用
    static String s1 = "我是类变量";

    final String MY_FIRST_FINAL = "第一个常量";

    //实例变量，从属于对象；如果不自行初始化，这个值就会为这个类型的默认值
    //需要把对象实例化出来才能用
    String s2 = "我是实例变量";

    public static void main(String[] args) {
        String s3 = "我是局部变量";
        System.out.println(s1);
        System.out.println(1%5);


        //位运算
        int a = 0b0011_1100;
        int b = 0b0000_1101;
        /*  &按位与  |按位或  ^异或运算   ~按位非
        * A = 0011_1100
        * B = 0000_1101
        * A&B = 0000_1100
        * A|B = 0011_1101
        * A^B = 0011_0001
        * ~B = 1111_0010

        * */
        System.out.println(Integer.toBinaryString(a&b));
        System.out.println(Integer.toBinaryString(a|b));
        System.out.println(Integer.toBinaryString(a^b));
        System.out.println(Integer.toBinaryString(~a));

        //3->0000_0011   0001_1000
        System.out.println(Integer.toBinaryString(3<<3));

    }

}
